﻿namespace ESoft.Locking
{
    /// <summary>
    /// 分布式锁
    /// </summary>
    public interface IDistributeLock
    {
        /// <summary>
        /// 获取锁
        /// </summary>
        /// <param name="lockKey">锁键</param>
        /// <param name="timeoutSpan">有效时间（毫秒）</param>
        /// <returns></returns>
        bool AcquireLock(string lockKey, double timeoutSpan=10000);

        /// <summary>
        /// 释放锁
        /// </summary>
        /// <param name="lockKey">锁键</param>
        /// <returns></returns>
        bool ReleaseLock(string lockKey);
    }
}
